home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Printer Drivers… / CustomWriterGX / About CustomWriter GX... next >
Encoding:
Text File  |  1995-10-17  |  3.4 KB  |  27 lines  |  [ttro/ttxt]

  1.  
  2. CustomWriter GX printer driver  version 1.0.4
  3. 17 October 1995
  4.  
  5. CustomWriter GX is a QuickDraw GX printer driver that implements both custom communications code and custom buffering code. The LaserWriter IIsc printer driver demonstrates how to write a QuickDraw GX printer driver that supports SCSI, which is also a form of custom communications. This sample code is a companion to the Print Hints column in issue #21 of develop magazine, which covers custom I/O and custom buffering in depth.
  6.  
  7. The CustomWriter GX printer driver creates 32-bit deep, 72 dpi PICT files for each page of a document it "prints." These files can be viewed with SimpleText or a graphics program. Because the PICTs consists of 32-bit deep pixmaps, each file will be roughly 1.2 megabytes. You probably don't want to print any Tolstoy novels with this driver.
  8.  
  9. The main purpose of this driver is, of course, to demonstrate how to write a printer driver which uses custom communications or buffering code. The CustomWriter GX printer driver also demonstrates how to support global data in a printer driver without using the standard methods supplied by QuickDraw GX. Most QuickDraw GX global data routines only work if called from within message overrides, but the approach used in the CustomWriter GX driver will work regardless of whether the calling code is in a message override or something like a callback routine.  (This is especially useful if you're implementing total overrides of the old API compatibility dialogs--not something that this printer driver does.)  Since I've received quite a few questions about how to implement this sort of global data, I've included an example of it in the CustomWriter GX driver. 
  10.  
  11. • Changes since 1.0.3
  12. The code has been modified so that the driver can be build under MPW, Metrowerks, and (in theory) Symantec.  In general, all that was required to do this was to add an inline-assembly jumptable to the .c files and to store all globals off of the message manager instance context.  I also made a few changes so that the driver can be rebuilt to support any resolution by changing the #defines kResolution and kPatStretch in "CommonDefines.h"
  13.  
  14. • Notes on building this diver under Metrowerks:
  15. The four project files required to build this sample were created with Metrowerks CodeWarrior version 7 (IDE version 1.3) even though there's no reason why one couldn't build it under CW6.  One reason I decided to use CW7 is that  is has support for compiling .r files which I find a lot easier to maintain.  The plug-in Rez compiler, although not present on the CW7 CD, can be downloaded from http://www.metrowerks.com/softlib.  
  16.  
  17. Originally, I wanted to have each of the four projects has the "Merge to file" option set which has the advantage of allowing you to make the four projects in any order.  There were two problems however: 1) Metrowerks puts up and alert if you try to build a "Merge to file" project and the target is missing. 2) CodeWarrior will not merge any resources (in .r or .rsrc format) into the target if this option is set. (Bummer)  So, to avoid these limitations, I had to turn off the "Merge to file" in one of the projects (I arbitrarily chose the PACK.π project) and included all the .r files in that project. This means that you must build "PACK.π" first and then build the others afterwards.
  18.  
  19.  
  20.  
  21. Enjoy.
  22.  
  23. David Hayward
  24. Developer Tecnical Support
  25.  
  26. Copyright ©1995, Apple Computer, Inc.
  27.